//user模块的仓库
const state = () => ({
    isLogin:false,
    userId:'',
    userName:'',
    avatar:'',
})

//mutations是唯一修改state的地方
const mutations = {
    SET_LOGIN:(state,islogin)=>{
        state.isLogin=islogin
    },
    SET_USERNAME: (state, username) => {
        state.userName=username
    },
    SET_USERID:(state,userid)=>{
        state.userId=userid
    },
    SET_AVATAR:(state,avatar)=>{
        state.avatar=avatar
    }
}

//action是用户处理派发action的地方，可以书写异步语句、逻辑的地方
const actions = {
    

}

const getters = {}
export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}